package com.yancy.controller;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @description:
 * @author: YancyZhang
 * @time: 2021/12/1 11:53
 */
@WebServlet("/amdinLogin")
public class AdminServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
//        跳转到admin页面
        if(req.getSession().getAttribute("user")!=null)
            req.getRequestDispatcher("/WEB-INF/views/admin.jsp").forward(req,resp);
        else
            req.getRequestDispatcher("login.jsp").forward(req,resp);
    }
}